package com.ljr.common;

import java.util.Map;

/**
 * @author ljr
 * @version 1.0
 * @description: TODO
 * @date 2021/12/21 7:48
 */
public class AuthToken{

    private static final long DEFAULT_EXPIRED_TIME_INTERVAL = 1*60*1000;

    private long expiredTimeInterval = DEFAULT_EXPIRED_TIME_INTERVAL;

    private long createTime;

    private String token;

    public static AuthToken create(String url, long createTime, Map<String, Object> params){
         String token = generateToken(url, createTime, params);
         return new AuthToken(createTime, token);
    }

    private static String generateToken(String url, long createTime, Map<String, Object> params) {
        return null;
    }

    public AuthToken(long expiredTimeInterval, long createTime, String token) {
        this.expiredTimeInterval = expiredTimeInterval;
        this.createTime = createTime;
        this.token = token;
    }

    public AuthToken(long createTime, String token) {
        this.createTime = createTime;
        this.token = token;
    }

    public boolean matchToken(String token){
        return true;
    }

    public boolean isExpired(){
        return true;
    }

    public String getToken() {
        return token;
    }
}
